var util = require('util');

function Base() {
    this.name = 'base';
    this.base = 1991;
    this.sayHello = function() {
        console.log('Hello,' + this.name);
    };
}

Base.prototype.showName = function() {
    console.log(this.name);
}

var b1 = new Base();
console.log(b1.name);
console.log(b1.base);
b1.sayHello();
b1.showName();

function Sub() {
    this.name = 'sub';
}

// Sub.prototype = Base.prototype;
util.inherits(Sub, Base);
console.log(Sub.prototype.showName);

var s1 = new Sub();
console.log(s1.name);
console.log(s1.base);
// s1.sayHello();
s1.showName();


People.prototype.a = 55;
function People(name, gender, age) {
    this.name = name;
    this.gender = gender;
    this.age = age;
}

var p1 = new People('waige', '男', 10);
console.log("========");
console.log(p1);
console.log(p1.a);

// People.call({'呵呵': 'haha'}, 'waige', '男', 20);

// Student.prototype = People.prototype;

function Student(name, gender, age, score) {
    People.call(this, name, gender, age);
    this.score = score;
}
util.inherits(Student, People);

var stu = new Student('小明', '男', 20, 100);
console.log(stu.a);




